<?php

namespace App\Http\Requests\Admin;

use App\Http\Requests\Base;

class CommunityServer extends Base
{

    public array $scenes = [
        'v1.create' => 'name,thumb,construct_time,occy_time,acreage,household_num,shop_num,garage_num,introductory,province_id,province_name,city_id,city_name,address,state',
        'v1.list' => 'noPage,pageSize',
        'v1.detail' => 'id',
        'v1.modify' => 'id,name,thumb,construct_time,occy_time,acreage,household_num,shop_num,garage_num,introductory,province_id,province_name,city_id,city_name,address,state',
        'v1.delete' => 'id',
    ];


    public function rules(): array
    {
        return [
            'id' => 'bail|required',
            'name' => 'bail|required|string',
            'thumb' => 'bail|required|string',
            'construct_time' => 'bail|required',
            'occy_time' => 'bail|required',
            'acreage' => 'bail|required',
            'household_num' => 'bail|required',
            'shop_num' => 'bail|required',
            'garage_num' => 'bail|required',
            'introductory' => 'bail|required',
            'province_id' => 'bail|required',
            'province_name' => 'bail|required',
            'city_id' => 'bail|required',
            'city_name' => 'bail|required',
//            'district_id' => 'bail|required',
//            'district_name' => 'bail|required',
            'address' => 'bail|required',


            'state' => 'bail|required|int|in:0,1,2',


            'noPage' => 'bail|nullable|min:1|numeric',
            'pageSize' => 'bail|nullable|min:1|numeric',

        ];
    }


    public function messages(): array
    {
        return [

            'id.required' => 'id不能为空',

            'name.required' => '小区名不能为空',
            'name.string' => '小区名格式不正确',

            'thumb.required' => '图片不能为空',
            'thumb.string' => '图片格式不正确',

            'construct_time.required' => '小区修建时间不能为空',
            'occy_time.required' => '小区入住时间时间不能为空',
            'acreage.required' => '小区面积不能为空',
            'household_num.required' => '住户(居住人数)不能为空',
            'shop_num.required' => '商铺(数量)不能为空',
            'garage_num.required' => '车库(数量)不能为空',
            'introductory.required' => '简介不能为空',
            'province_id.required' => '省id不能为空',
            'province_name.required' => '省不能为空',
            'city_id.required' => '市id不能为空',
            'city_name.required' => '市不能为空',
            'district_id.required' => '区id不能为空',
            'district_name.required' => '区不能为空',
            'address.required' => '详细地址不能为空',


            'state.required' => '状态不能为空',
            'state.in' => '状态值不支持',

            'noPage.min' => '页码不能小于1',
            'noPage.numeric' => '页码格式非法',
            'pageSize.min' => '查询条数不能小于1',
            'pageSize.numeric' => '查询条数格式非法',


        ];
    }

}
